home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 020a / atipinfo.zip / PROGINFO.DOC
Text File  |  1991-04-11  |  48KB  |  1,074 lines

  1.  
  2. April 10, 1991
  3.  
  4. 1.0  INTRODUCTION
  5.  
  6. 1.1  PURPOSE
  7.  
  8.      The purpose of this document is to aid professional programmers who
  9.      wish to write software to use the high resolution modes supported by
  10.      the VGAWONDER video board. Working knowledge of EGA/VGA graphics and
  11.      assembly language programming is required and assumed. The document
  12.      describes several features unique to the VGAWONDER and how each high
  13.      resolution mode is similar or is different compared to standard VGA
  14.      modes. It does not contain any programming information about standard
  15.      EGA/VGA modes. Refer to the Reference list in the appendix for
  16.      recommended EGA/VGA programmer's references.
  17.  
  18. 1.2  CONVENTIONS
  19.  
  20.      The code segments contained in this document follow the conventions of
  21.      the MicroSoft MASM assembler. Numbers given in hexadecimal end with a
  22.      lower case h.
  23.  
  24. 2.0  FEATURES OF THE VGA BOARD
  25.  
  26. 2.1  STANDARD VIDEO MODES
  27.  
  28.      AH = 0  ;set video mode
  29.  
  30.      AL =    MODE/             RESOLUTION      DIM/          START
  31.              TYPE                              COLOR         ADDRESS
  32.      ---------------------------------------------------------------
  33.      0h      color/alpha       640x200         40x25/ BW     b800:0h
  34.      1h      color/alpha       640x200         40x25/ 16     b800:0h
  35.      2h      color/alpha       640x200         80x25/ BW     b800:0h
  36.      3h      color/alpha       640x200         80x25/ 16     b800:0h
  37.      0*      color/alpha       640x350         40x25/ BW     b800:0h
  38.      1*      color/alpha       640x350         40x25/ 16     b800:0h
  39.      2*      color/alpha       640x350         80x25/ BW     b800:0h
  40.      3*      color/alpha       640x350         80x25/ 16     b800:0h
  41.      0+      color/alpha       720x400         40x25/ BW     b800:0h
  42.      1+      color/alpha       720x400         40x25/ 16     b800:0h
  43.      2+      color/alpha       720x400         80x25/ BW     b800:0h
  44.      3+      color/alpha       720x400         80x25/ 16     b800:0h
  45.      4h      color/graphics    320x200         40x25/  4     b800:0h
  46.      5h      color/graphics    320x200         40x25/ BW     b800:0h
  47.      6h      color/graphics    320x200         80x25/ BW     b800:0h
  48.      7h      mono/alpha        720x350         80x25/ BW     b000:0h
  49.      0dh     color/graphics    320x200         40x25/ 16     a000:0h
  50.      0eh     color/graphics    640x200         80x25/ 16     a000:0h
  51.      0fh     mono/graphics     640x350         80x25/ BW     a000:0h
  52.      10h     color/graphics    640x350         80x25/ 16     a000:0h
  53.      11h     color/graphics    640x480         80x30/ BW     a000:0h
  54.      12h     color/graphics    640x480         80x30/ 16     a000:0h
  55.      13h     color/graphics    320x200         80x25/256     a000:0h
  56. 2.2  ENHANCED VIDEO MODES
  57.  
  58.      23h     color/alpha       1056x350        132x25/16     b800:0h
  59.      27h     mono/alpha        1056x350        132x25/BW     b000:0h
  60.      33h     color/alpha       1056x352        132x44/16     b800:0h
  61.      37h     mono/alpha        1056x352        132x44/BW     b000:0h
  62.      53h     color/graphics    800x560         16            a000:0h
  63.      54h     color/graphics    800x600         16            a000:0h
  64.      55h     color/graphics    1024X768        16            a000:0h
  65.      61h     color/graphics    640x400         256           a000:0h
  66.      62h     color/graphics    640x480         256           a000:0h
  67.      63h     color/graphics    800x600         256           a000:0h
  68.      64h     color/graphics    1024x768        256           a000:0h
  69.      65h     color/graphics    1024x768        16            a000:0h
  70.      67h     color/graphics    1024x768        4             a000:0h
  71.  
  72. 2.3  REQUIRED CONFIGURATIONS
  73.  
  74.      The enhanced modes have differing memory requirements. Some enhanced 
  75.      modes are supported only on certain monitor types or hardware revisions. 
  76.      The following chart describes the requirements for each enhanced mode.
  77.  
  78.      Mode#   Resolution      Colors/         Memory          Monitors
  79.      (hex)                   Palette         Required        Supported
  80.      -----------------------------------------------------------------
  81.      23      132x25          16/64           512K            1,2,5
  82.      27      132x25          B&W             512K            1,2,5
  83.      33      132x44          16/64           512K            1,2,5
  84.      37      132x44          B&W             512K            1,2,5
  85.      54      800x600         16/256K         256K            5
  86.      55*     1024X768        256/256K        256K            4,5 
  87.      61      640x400         256/256K        512K            3,4,5
  88.      62      640x480         256/256K        512K            3,4,5
  89.      63      800x600         256/256K        512K            5
  90.      64#     1024x768        256/256K        1M              4,5
  91.      65      1024x768        16/256K         512K            4,5
  92.      67      1024x768        4/16            256K            4,5
  93.  
  94.      Monitors: (1) TTL mono (2) EGA (3) VGA (4) IBM 8514 (5) Multisync
  95.  
  96.      * not supported on VGAWONDER V3
  97.      # only supported on VGAWONDER+ 1Mb
  98.  
  99. 3.0  DETERMINING THE STATUS OF THE CARD
  100.  
  101.      The VGA BIOS features some special functions which will allow the
  102.      programmer to determine if a compatible VGA board is installed and how
  103.      the card is configured within his program.
  104.  
  105. 3.1  IDENTIFYING THE VIDEO CARD
  106.  
  107.      All EGA and VGA display adapters manufactured by ATI Technologies will
  108.      contain the character string: "761295520" starting at address: C000:31.
  109.      VGA boards which are based on the ATI VGA chip set are identified by the         
  110.    character string "31" at address C000:40. The card is further identified 
  111.      by 2 bytes. The definition of the byte at address C000:42 is:
  112.  
  113.                bit 0   = 0 16-bit VGA board
  114.                bit 0   = 1  8-bit VGA board
  115.                bit 1   = 1 mouse port present on display adapter
  116.                bit 2   = 1 supports non-interlaced 1024x768
  117.                bit 3   = 1 microchannel product
  118.                bit 4   = 1 contains programmable video clock chip
  119.                bit 5-7 = not currently defined
  120.  
  121.      The character at address C000:43 contains the revision of the VGA gate
  122.      array. Currently, the following models exist and other revisions 
  123.      may follow in the future.
  124.  
  125.               '1' = 18800
  126.               '2' = 18800-1
  127.               '3' = 28800-2
  128.               '4' = 28800-4
  129.               '5' = 28800-5
  130.  
  131. 3.2  DETERMINING THE MONITOR TYPE
  132.  
  133.      The following assembler code segment can be used to determine for
  134.      which monitor the VGA board is currently configured.
  135.  
  136.                          cli
  137.                          mov     dx,EXTENDED_REG
  138.                          mov     al,DATA_I
  139.                          out     dx,al
  140.                          inc     dx
  141.                          in      al,dx
  142.                          sti
  143.                          and     al,0fh
  144.  
  145.      returns  al =       0       EGA monitor
  146.                          1       PS/2 monochrome monitor
  147.                          2       TTL monochrome monitor
  148.                          3       PS/2 color monitor
  149.                          4       RGB color monitor
  150.                          5       Multisync monitor
  151.                          7       PS/2 8514 monitor
  152.                          8       Seiko 1430          
  153.                          9       NEC MultiSync 2A
  154.                          a       Crystalscan 860/Tatung 1439
  155.                          b       NEC MultiSync 3D
  156.                          c       TVM 3M         
  157.                          d       NEC MultiSync XL
  158.                          e       TVM 2A
  159.                          f       TVM 3A
  160.  
  161.      where
  162.                          EXTENDED_REG = see section 4.41 in this document
  163.                                DATA_I = 0bbh
  164.  
  165.      Note : We reserve the right to add more monitor types at any time. We
  166.      recommend that if an undefined value is returned that the program
  167.      assumed that a multisync is installed.
  168.  
  169. 3.3  DETERMINING MEMORY SIZE
  170.  
  171.      In terms of memory determination, ATI VGA chipsets fall into 3 groups. The first
  172. group is identified as types 1 and 2 (see section 3.31). The second group is identified as
  173. type 3 and the third group as type 4 or 5. All types can be equipped with 256K or 512K
  174. of RAM. Only types 4 or 5 may be equipped with 1M of RAM.
  175.  
  176. The following code segment will determine the type of chipset and use the appropriate
  177. method to determine memory size.
  178.  
  179. .MODEL small,C
  180. .CODE
  181.  
  182. PUBLIC RAMSIZE
  183. ; --------------------------------------------------------------------------
  184. ; CALL VALUES: none
  185. ; RETURNS VALUES: AX = 256 (100h) for 256K bytes
  186. ;                      512 (200h) for 512K bytes
  187. ;                      1024 (400h) for 1024K bytes
  188.  
  189. RAMSIZE PROC NEAR
  190.         push bx                      ; Save used register values
  191.         push dx
  192.         push ds
  193.         mov  ax, 0c000h
  194.         mov  ds, ax
  195.         xor  ax, ax
  196.         mov  dx, word ptr ds:[0010h] ; Get value of ATI extended register
  197.         mov  bl, byte ptr ds:[0043h] ; Get value of ATI chip version
  198.         pop  ds
  199.         mov  bh, 1                   ; Assume 256K ramsize (100h)
  200.         cmp  bl, '3'
  201.         jae  ramsize_V6_up           ; Use different method to determine
  202.         mov  al, 0bbh                ;  memory size of chip version is 3 or
  203.         cli                          ;  higher
  204.         out  dx, al
  205.         inc  dx
  206.         in   al, dx                  ; Get ramsize byte for chip versions
  207.         sti                          ;  1 & 2
  208.         test al, 20h
  209.         jz   eo_ramsize
  210.         mov  bh, 2                   ; Set ramsize return value to 512K (200h)
  211.         jmp  short eo_ramsize        ;  and exit
  212.  
  213. ramsize_V6_up:                       ; Method used for newer ATI chip versions
  214.         mov  al, 0b0h
  215.         cli
  216.         out  dx, al
  217.         inc  dx
  218.         in   al, dx                  ; Get ramsize byte for versions 3-5
  219.         sti
  220.         test al, 10h                 ; Check if ramsize byte indicates 256K
  221.         jz   ramsize_V7_up           ;  or 512K bytes
  222.         mov  bh, 2                   ; Set ramsize return value to 512K (200h)
  223.  
  224. ramsize_V7_up:                       ; Check for ramsize for ATI chip
  225.         cmp  bl, '4'                 ;  versions 4 & 5
  226.         jb   eo_ramsize
  227.         test al, 8                   ; Check if version 5 ATI chip has 1024K
  228.         jz   eo_ramsize
  229.         mov  bh, 4                   ; Set ramsize return value to 1024K (400h)
  230.  
  231. eo_ramsize:
  232.         xor  bl,bl                   ; Zero lower byte of BX
  233.         mov  ax, bx                  ; Return actual ramsize value in AX
  234.  
  235.         pop  dx                      ; Restore BX and DX registers
  236.         pop  bx
  237.         ret
  238. RAMSIZE ENDP
  239. ; --------------------------------------------------------------------------
  240.  
  241.         END
  242.  
  243. 3.4  DETERMINING WHETHER A MODE IS SUPPORTED
  244.  
  245.      Your VGA board implements an extended video BIOS call which can be
  246.      used to determine if a particular mode is actually available in the
  247.      user's current configuration. The following assembler routine
  248.      demonstrates this technique:
  249.  
  250.                push      bp
  251.                mov       bp,sp
  252.                push      es
  253.                mov       al,ARG
  254.                mov       ah,12h
  255.                mov       bx,5506h
  256.                mov       bp,0ffffh
  257.                int       10h
  258.                mov       ax,bp
  259.                pop       es
  260.                pop       bp
  261.                ret
  262.  
  263.                where ARG = mode desired in hexadecimal
  264.  
  265.      If this routine returns ax = 0ffffh, that mode is not supported in the
  266.      current configuration. If the mode is supported, ax will contain the
  267.      offset start address of the CRTC parameter table for that mode.
  268.  
  269.      Note : We recommend this technique as the only reliable means of
  270.      determining if a particular mode is supported on our EGA or VGA boards.
  271.  
  272. 4.0  PROGRAMMING THE HIGH RESOLUTION MODES
  273.  
  274. 4.1  SETTING THE VIDEO MODE
  275.  
  276.      The VGA card can be set into a video mode through the BIOS by using
  277.      the standard IBM method: AH is set to 0, AL is set to the video mode
  278.      number, and a call to software interrupt 10h is executed. See sections
  279.      2.1 and 2.2 of this manual for a list of available modes. The
  280.      following example will perform this function:
  281.  
  282.               mov ah,0            ;set mode function
  283.               mov al,MODE         ;select video mode
  284.               int 10h             ;make BIOS call by using the video
  285.                                   ;interrupt
  286.  
  287.      We recommend that programmers select the video mode through BIOS
  288.      whenever possible rather than programming the mode via the registers.
  289.      For any particular video mode, the configuration of the internal
  290.      registers may differ depending on the type of monitor installed.
  291.      Also, we reserve the right to change the product in a way which would
  292.      be transparent to BIOS but which would have an impact on software
  293.      which writes to the registers.
  294.  
  295. 4.2  VIDEO MEMORY ADDRESSING
  296.  
  297. 4.21 ADDRESS RANGE OF VGA BOARD
  298.  
  299.      The VGA board uses the RESERVED area designated by IBM for video
  300.      RAM and the video BIOS (A000 to C7FF). The organization is as follows:
  301.  
  302.      Mono text video RAM:  B000-B7FF
  303.      Color text video RAM: B800-BFFF
  304.      Graphics video RAM:   A000-AFFF (upto eight 64k banked pages with 512K
  305.                                       RAM)
  306.      Video BIOS:           C000-C7FF
  307.      I/O Ports:            1CE-ICF, 3B0-3DF    
  308.  
  309. 4.22 PAGES and PLANES:
  310.  
  311.      There are two memory mapping systems used with VGA graphics modes:
  312.      Packed pixel and Planar organization.
  313.  
  314.      The Packed pixel mapping scheme is associated with pages and uses
  315.      contiguous memory to describe each pel. IBM VGA mode 13h uses this
  316.      system. Extended modes 61, 62, 63, and 65h also use the Bit-packed
  317.      scheme but they use a unique method to select which page is
  318.      available for reading and writing.
  319.  
  320.      The Planar organized memory mapping scheme is associated with
  321.      planes and uses a bit from each plane to describe a pel. IBM VGA
  322.      mode 12h uses this system as does Extended modes 54h, 55h and 67h.
  323.  
  324. 4.23 SELECTING MEMORY PAGES:
  325.  
  326.      The memory organization of extended modes 61h, 62h, 63h, 64h and 65h are
  327.      arranged into 64k page segments. The data in each page is displayed on
  328.      a specific region of the screen image. For example, mode 63h has eight
  329.      pages. The first page is displayed on the top eighth of the screen
  330.      image, the second page is displayed on the second eighth of the screen
  331.      image, and so on. Data can be read or written to one page at a time.
  332.      The default active page is Page 0. A special code segment is required
  333.      to be executed before data can be read or written to a specific page.
  334.      A page selecting code segment is provided below. VGA cards with 256K
  335.      of RAM have four, those with 512K have eight and those with 1M have 16 
  336.      pages available. Modes 61h, 62h, 63h and 64h require 1 byte per pel and 
  337.      mode 65h requires 1/2 byte per pel.
  338.  
  339.      The following code segment can be used to select the required page:
  340.  
  341.               cli
  342.               mov     dx,EXTENDED_REG
  343.               mov     al,PAGE_SELECT
  344.               out     dx,al
  345.               inc     dl
  346.               in      al,dx
  347.               mov     ah,al
  348.               and     ah,PAGE_MASK
  349.               shl     ch,1
  350.               or      ah,ch
  351.               mov     al,PAGE_SELECT
  352.               dec     dl
  353.               out     dx,ax
  354.               sti
  355.  
  356.      where    ch = required page value (0 to 7 for mode 63h for example)
  357.               PAGE_SELECT  = 0B2h
  358.               PAGE_MASK    = 0E1h
  359.               EXTENDED_REG = value of extended register stored at memory
  360.                              address C000:0010h. See section 4.31
  361.  
  362.  
  363.      The following is a table that describes the visible range for
  364.      each extended mode which uses the bit-packed memory organization:
  365.  
  366.      Mode 61h (640 x 400 - 256 colors):
  367.  
  368.      Page            Visible range  (column,row)              Memory range
  369.      0               (0,0)      -->  (255,102)                A0000 - AFFFF
  370.      1               (256,102)  -->  (511,204)                A0000 - AFFFF
  371.      2               (512,204)  -->  (127,307)                A0000 - AFFFF
  372.      3               (128,307)  -->  (639,399)                A0000 - AE7FF
  373.  
  374.      Mode 62h (640 x 480 - 256 colors):
  375.  
  376.      Page            Visible range  (column,row)              Memory range
  377.      0               (0,0)      -->  (255,102)                A0000 - AFFFF
  378.      1               (256,102)  -->  (511,204)                A0000 - AFFFF
  379.      2               (512,204)  -->  (127,307)                A0000 - AFFFF
  380.      3               (128,307)  -->  (383,409)                A0000 - AFFFF
  381.      4               (384,409)  -->  (639,479)                A0000 - AAFFF
  382.  
  383.      Mode 63h (800 x 600 - 256 colors):
  384.  
  385.      Page            Visible range  (column,row)              Memory range
  386.      0               (0,0)      -->  (735,81)                 A0000 - AFFFF
  387.      1               (736,81)   -->  (671,163)                A0000 - AFFFF
  388.      2               (672,163)  -->  (607,245)                A0000 - AFFFF
  389.      3               (608,245)  -->  (543,327)                A0000 - AFFFF
  390.      4               (544,327)  -->  (479,409)                A0000 - AFFFF
  391.      5               (480,409)  -->  (415,491)                A0000 - AFFFF
  392.      6               (416,491)  -->  (351,573)                A0000 - AFFFF
  393.      7               (352,573)  -->  (799,599)                A0000 - A561F
  394.  
  395.      Mode 64h (1024 x 768 - 256 colors):
  396.      Page            Visible range  (column,row)              Memory range
  397.      0               (0,0)      -->  (1023,63)                 A0000 - AFFFF
  398.      1               (0,64)     -->  (1023,127)                A0000 - AFFFF
  399.      2               (0,128)    -->  (1023,190)                A0000 - AFFFF
  400.      3               (0,191)    -->  (1023,255)                A0000 - AFFFF
  401.      4               (0,256)    -->  (1023,319)                A0000 - AFFFF
  402.      5               (0,320)    -->  (1023,383)                A0000 - AFFFF
  403.      6               (0,384)    -->  (1023,447)                A0000 - AFFFF
  404.      7               (0,448)    -->  (1023,511)                A0000 - AFFFF
  405.      8               (0,512)    -->  (1023,575)                A0000 - AFFFF
  406.      9               (0,576)    -->  (1023,639)                A0000 - AFFFF
  407.      10              (0,640)    -->  (1023,703)                A0000 - AFFFF
  408.      11              (0,704)    -->  (1023,767)                A0000 - AFFFF
  409.      12                       spare
  410.      13                       spare
  411.      14                       spare
  412.      15                       spare
  413.      
  414.      Mode 65h (1024 x 768 - 16 colors):
  415.  
  416.      Page            Visible range  (column,row)              Memory range
  417.      0               (0,0)      -->  (1023,127)               A0000 - AFFFF
  418.      1               (0,128)    -->  (1023,255)               A0000 - AFFFF
  419.      2               (0,256)    -->  (1023,383)               A0000 - AFFFF
  420.      3               (0,384)    -->  (1023,511)               A0000 - AFFFF
  421.      4               (0,512)    -->  (1023,639)               A0000 - AFFFF
  422.      5               (0,640)    -->  (1023,767)               A0000 - AFFFF
  423.      6                        spare
  424.      7                        spare
  425.  
  426. 4.3  DETAILS OF EACH EXTENDED VIDEO MODE
  427.  
  428. 4.31 132X25 - Color text (Mode 23h)
  429.      132x25 - B&W text (Mode 27h)
  430.      132X44 - Color text (Mode 33h)
  431.      132X44 - B&W text (Mode 37h)
  432.  
  433.      Video Memory Organization:
  434.  
  435.      The memory organization of very similar to standard text modes. Only 
  436.      one page of 6,660 bytes (132X25 modes) or 11,616 bytes (132X44 modes) 
  437.      is availible. 
  438.  
  439.      Video Data Organization:
  440.  
  441.      The video data organization is identical to standard text modes.
  442.  
  443.      BIOS support
  444.  
  445.      All BIOS calls supported on standard text modes are supported. 
  446.  
  447.      NOTE! It is a good idea to avoid DOS calls when using the 132X44 text 
  448.      modes. Most versions of ANSI.SYS are not compatible with text modes 
  449.      which have more than 25 lines. This is particularly a problem when 
  450.      scrolling the screen.
  451.  
  452. 4.32 800x600 - 16 COLORS (Mode 54h)
  453.  
  454.      Video Memory Organization:
  455.  
  456.      The memory organization is identical to 16 color IBM EGA/VGA modes
  457.      and consists of 256K organized into 4 maps of 64K each. One bit from
  458.      each of the 4 maps is used to compose each pel. The IBM EGA/VGA Map
  459.      Mask Register is used to select any or all the maps to be updated.
  460.       A0000:0 -> ----------
  461.                 |          |----------
  462.                 |          |          |----------
  463.                 |----------|          |          |---------- <===\=======\
  464.                 | Reserved |----------|          |          |  60,000    |
  465.                  ----------| Reserved |----------|          |    |       |
  466.                    Plane 0  ----------| Reserved |----------|<===/      64K
  467.                               Plane 1  ----------| Reserved |            |
  468.                                           Plane 2   --------- <===========/
  469.                                                      Plane 3
  470.  
  471.      Video Data Format:
  472.  
  473.      The video data format is identical to the 16 color IBM EGA/VGA modes. 
  474.  
  475.      Color Mapping:
  476.  
  477.      Color selection and palette changing is identical to the 16 color IBM 
  478.      EGA/VGA mode
  479.  
  480. 4.33 1024x768 - 16 COLORS PLANAR (Mode 55h)
  481.  
  482.      Video Memory Organization:
  483.  
  484.      The memory organization is similar to 16 color IBM EGA/VGA modes
  485.      and consists of 2 pages of 256K each organized into 4 maps of 64K. One 
  486.      bit from each of the 4 maps is used to compose each pel. The IBM 
  487.      EGA/VGA Map Mask Register is used to select any or all the maps to be 
  488.      updated.
  489.  
  490.  
  491.  
  492.      Address                                 Page #
  493.  
  494.      A000:0 ==> +-----+-----+-----+-----+
  495.                 |     |     |     |     |
  496.                 |     |     |     |     |
  497.                 |     |     |     |     |      0 
  498.                 |     |     |     |     |
  499.                 |     |     |     |     |
  500.      A000:0 ==> +-----+-----+-----+-----+
  501.                 |     |     |     |     |
  502.                 |     |     |     |     |
  503.                 |     |     |     |     |      1
  504.                 |     |     |     |     |
  505.                 |     |     |     |     |
  506.                 +-----+-----+-----+-----+
  507.      Map #         0     1     2     3
  508.  
  509.  
  510.      Selecting Memory Page:
  511.  
  512.  
  513.      The following code segment demonstates how to switch between pages 
  514.      when in this mode. 
  515.  
  516.      To change the write plane
  517.               cli
  518.               mov     dx,ATI_REG
  519.               mov     al,PLANE_SELECT
  520.               out     dx,al
  521.               inc     dl
  522.               in      al,dx
  523.               mov     ah,al
  524.               and     ah,WPLANE_MASK
  525.               shl     ch,1
  526.               or      ah,ch
  527.               mov     al,PLANE_SELECT
  528.               dec     dl
  529.               out     dx,ax
  530.               sti
  531.  
  532.      To change the read plane
  533.               cli
  534.               mov     dx,ATI_REG
  535.               mov     al,PLANE_SELECT
  536.               out     dx,al
  537.               inc     dl
  538.               in      al,dx
  539.               mov     ah,al
  540.               and     ah,RPLANE_MASK
  541.               shl     ch,1
  542.               shl     ch,1
  543.               shl     ch,1
  544.               shl     ch,1
  545.               rol     ch,1
  546.               or      ah,ch
  547.               mov     al,PLANE_SELECT
  548.               dec     dl
  549.               out     dx,ax
  550.               sti
  551.  
  552.               Where ch = page number required
  553.                     ATI_REG = store in location c000:10h
  554.                     PLANE_MASK = 0e1h
  555.                     WPLANE_MASK = 0e1h
  556.                     RPLANE_MASK = 01eh
  557.                     PLANE_SELECT = 0b2h
  558.                     DIFF_RW_PLANE = 008h
  559.                     MISC2_REG = 0beh
  560.                     DATA_I = 0bbh
  561.     
  562.      The read and write planes can be changed simultaneously.
  563.  
  564.     4.36 800x600 - 256 COLORS (Mode 63h)
  565.  
  566.      Video Memory Configuration:
  567.  
  568.      This enhanced resolution mode uses a page memory system unique to this
  569.      VGA board. The memory is organized into contiguous 64K blocks located
  570.      at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
  571.      to support this mode. Mode 63h uses eight 64K pages. For information
  572.      on selecting the active page, refer to section 4.23 "SELECTING MEMORY
  573.      PAGES" of this document.
  574.  
  575.  
  576.       A0000:0 -> ----------<==============================================\
  577.                 |          |----------                                     |
  578.                 |          |          |----------                          |
  579.                 |          |          |          | \                       |
  580.                 |          |          |          |  \                      |
  581.                  ----------|          |          |   \                     |
  582.                     Page 0  ----------|          |    \                    |
  583.                                Page 1  ----------       ---------- <=\  480,000
  584.                                           Page 3  \    |          |  |     |
  585.                                                    \   |          | 64K    |
  586.                                                     \  |          |  |     |
  587.                                                      \ |          |  |     |
  588.                                                         ---------- <=/=====/
  589.                                                            Page 7
  590.  
  591.  
  592.      Video Data Format:
  593.  
  594.      The video data format is identical to IBM VGA mode 13h (320x200-256
  595.      color). Each pel is represented by 1 byte.
  596.  
  597.      Color Mapping:
  598.  
  599.      Color selection and palette changing is identical to VGA mode 13h.
  600.  Video Data Format:
  601.  
  602.      The video data format is identical to the 16 color IBM EGA/VGA modes. 
  603.  
  604.      Color Mapping:
  605.  
  606.      Color selection and palette changing is identical to the 16 color IBM 
  607.      EGA/VGA mode
  608.  
  609. 4.34 640x400 - 256 COLORS (Mode 61h)
  610.  
  611.      Video Memory Configuration:
  612.      This enhanced resolution mode uses a page memory system unique to this
  613.      VGA board. The memory is organized into contiguous 64K blocks located
  614.      at A0000H to AFFFFH. A VGA board equipped with 256K or 512K of RAM
  615.      will support this mode. Mode 61h uses four 64K pages.  For information
  616.      on selecting the active page, refer to section 4.23 "SELECTING MEMORY
  617.      PAGES" of this document.
  618.  
  619.        A0000:0->-----------<===========================================\
  620.                 |          |----------                                |
  621.                 |          |          |----------                     |
  622.                 |          |          |          |---------- <==\=====|
  623.                 |          |          |          |          |   |     |
  624.                  ----------|          |          |          |  64K    |
  625.                   Page 0    ----------|          |          |   |   256,000
  626.                                Page 1  ----------|          |   |     |
  627.                                           Page 2  ---------- <==/=====/
  628.                                                      Page 3
  629.  
  630.  
  631.      Video Data Format:
  632.  
  633.      The video data format is identical to IBM VGA mode 13h (320x200-256
  634.      color). Each pel is represented by 1 byte.
  635.  
  636.      Color Mapping:
  637.  
  638.      Color selection and palette changing is identical to VGA mode 13h.
  639.  
  640. 4.35 640x480 - 256 COLORS (Mode 62h)
  641.  
  642.      Video Memory Configuration:
  643.  
  644.      This enhanced resolution mode uses a page memory system unique to this
  645.      VGA board. The memory is organized into contiguous 64K blocks located
  646.      at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
  647.      to support this mode. Mode 62h uses five 64K pages. For information on
  648.      selecting the active page, refer to section 4.23 "SELECTING MEMORY
  649.      PAGES" of this document.
  650.  
  651.  
  652.       A0000:0 -> ---------- <=============================================\
  653.                 |          |---------                                      |
  654.                 |          |         |---------                            |
  655.                 |          |         |         |---------                  |
  656.                 |          |         |         |         |--------- <=\    |
  657.                  ----------|         |         |         |         |  |    |
  658.                    Page 0   ---------|         |         |         | 64K   |
  659.                               Page 1  ---------|         |         |  | 307,200
  660.                                         Page 2  ---------|         |  |    |
  661.                                                   Page 3  --------- <=/====/
  662.                                                             Page 4
  663.  
  664.  
  665.      Video Data Format:
  666.      The video data format is identical to IBM VGA mode 13h (320x200-256
  667.      color). Each pel is represented by 1 byte.
  668.  
  669.      Color Mapping:
  670.  
  671.      Color selection and palette changing is identical to VGA mode 13h.
  672.  
  673. 4.36 800x600 - 256 COLORS (Mode 63h)
  674.  
  675.      Video Memory Configuration:
  676.  
  677.      This enhanced resolution mode uses a page memory system unique to this
  678.      VGA board. The memory is organized into contiguous 64K blocks located
  679.      at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
  680.      to support this mode. Mode 63h uses eight 64K pages. For information
  681.      on selecting the active page, refer to section 4.23 "SELECTING MEMORY
  682.      PAGES" of this document.
  683.  
  684.  
  685.       A0000:0 -> ----------<==============================================\
  686.                 |          |----------                                     |
  687.                 |          |          |----------                          |
  688.                 |          |          |          | \                       |
  689.                 |          |          |          |  \                      |
  690.                  ----------|          |          |   \                     |
  691.                     Page 0  ----------|          |    \                    |
  692.                                Page 1  ----------       ---------- <=\  480,000
  693.                                           Page 3  \    |          |  |     |
  694.                                                    \   |          | 64K    |
  695.                                                     \  |          |  |     |
  696.                                                      \ |          |  |     |
  697.                                                         ---------- <=/=====/
  698.                                                            Page 7
  699.  
  700.  
  701.      Video Data Format:
  702.  
  703.      The video data format is identical to IBM VGA mode 13h (320x200-256
  704.      color). Each pel is represented by 1 byte.
  705.  
  706.      Color Mapping:
  707.  
  708.      Color selection and palette changing is identical to VGA mode 13h.
  709.  
  710. 4.37 800x600 - 256 COLORS (Mode 64h)
  711.  
  712.      Video Memory Configuration:
  713.  
  714.      This enhanced resolution mode uses a page memory system unique to this
  715.      VGA board. The memory is organized into contiguous 64K blocks located
  716.      at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
  717.      to support this mode. Mode 64h uses sixteen 64K pages. For information
  718.      on selecting the active page, refer to section 4.23 "SELECTING MEMORY
  719.      PAGES" of this document.
  720.  
  721.       A0000:0 -> ----------<==============================================\
  722.                 |          |----------                                     |
  723.                 |          |          |----------                          |
  724.                 |          |          |          | \                       |
  725.                 |          |          |          |  \                      |
  726.                  ----------|          |          |   \                     |
  727.                     Page 0  ----------|          |    \                    |
  728.                                Page 1  ----------       ---------- <=\  786,432
  729.                                           Page 3  \    |          |  |     |
  730.                                                    \   |          | 64K    |
  731.                                                     \  |          |  |     |
  732.                                                      \ |          |  |     |
  733.                                                         ---------- <=/=====/
  734.                                                            Page 15
  735.  
  736.  
  737.      Video Data Format:
  738.  
  739.      The video data format is identical to IBM VGA mode 13h (320x200-256
  740.      color). Each pel is represented by 1 byte.
  741.  
  742.      Color Mapping:
  743.  
  744.      Color selection and palette changing is identical to VGA mode 13h.
  745.  
  746. 4.38 1024x768 - 16 COLORS (Mode 65h)
  747.  
  748.      Video Memory Organization:
  749.  
  750.      This enhanced resolution mode uses a page memory system unique to this
  751.      VGA board. The memory is organized into contiguous 64K blocks located
  752.      at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
  753.      to support this mode. Mode 65h uses eight 64K pages. For information
  754.      on selecting the active page, refer to section 4.23 "SELECTING MEMORY
  755.      PAGES" of this document.
  756.  
  757.      A0000:0 -> ---------- <=============================================\
  758.  
  759.                |          |----------                                    |
  760.                |          |          |----------                         |
  761.                |          |          |          | \                      |
  762.                |          |          |          |  \                     |
  763.                 ----------|          |          |   \                    |
  764.                   Page 0   ----------|          |    \                   |
  765.                               Page 1  ----------       ---------- <==\ 402,432
  766.                                         Page 2   \    |          |   |   |
  767.                                                   \   |          |   |   |
  768.                                                    \  |          |  64K  |
  769.                                                     \ |          |   |   |
  770.                                                        ---------- <==/===/
  771.                                                           Page 7
  772.  
  773.      Video Data Format:
  774.      The video data format is unique to this mode. Each pel requires 4 bits
  775.      or half a byte.
  776.  
  777.        ____________________________________________ High Order
  778.       |    |    |    |    |                              Pixel
  779.       |____|____|____|____|____ ____ ____ ____
  780.       |  H |  H |  H |  H |  L |  L |  L |  L |
  781.       |____|____|____|____|____|____|____|____|
  782.                           |    |    |    |    |
  783.                           |____|____|____|____|________ Low Order
  784.                                                             Pixel
  785.  
  786.      Color Mapping:
  787.  
  788.      This mode has a different memory organization than standard EGA mode
  789.      10h. If users want to use colors other than the standard 16 colors,
  790.      users are required to re-program the external palettes (3C8h/3C9h). Re-
  791.      programming the internal palettes (3C0h) will not work the same as it
  792.      would in EGA mode 10h because the color mapping in mode 65h is
  793.      different. It is not recommended to change the internal palettes at
  794.      all for mode 65h. The following table shows the mapping of colors and
  795.      external palettes.
  796.  
  797.      Palette registers available for re-programming are:
  798.  
  799.       Palette register   Palette register       default color   color
  800.       (low order pels)   (high order pels)      assignment      value
  801.       ----------------   -----------------      -------------   -----
  802.            00h                 00h                Black           0h
  803.            01h                 10h                Blue            1h
  804.            02h                 20h                Green           2h
  805.            03h                 30h                Cyan            3h
  806.            04h                 40h                Red             4h
  807.            05h                 50h                Magenta         5h
  808.            06h                 60h                Brown           6h
  809.            07h                 70h                White           7h
  810.            08h                 80h                Dark Gray       8h
  811.            09h                 90h                Light Blue      9h
  812.            0Ah                 A0h                Light Green     Ah
  813.            0Bh                 B0h                Light Cyan      Bh
  814.            0Ch                 C0h                Light Red       Ch
  815.            0Dh                 D0h                Light Magenta   Dh
  816.            0Eh                 E0h                Yellow          Eh
  817.            0Fh                 F0h                Bright White    Fh
  818.  
  819.      For example, to change the default color assignment for palette
  820.      register 4 from Red to Bright White, palette register 4 and 40h would
  821.      need to be re-programmed with the values:
  822.  
  823.             Red Intensity = 3Fh
  824.             Green Intensity = 3Fh
  825.             Blue Intensity = 3Fh
  826.  
  827.      so that both the low order AND high order pels are affected. The only
  828.      exception is palette register 0 (Black); re-programming this register
  829.      will affect both the low order and high order pels.
  830.  
  831.      An Example:
  832.  
  833.      The following example uses a standard IBM EGA/VGA BIOS call. If more
  834.      information is required, consult the IBM EGA/VGA programmers reference
  835.      list included in this document.
  836.  
  837.      Example segment to re-program a palette register:
  838.  
  839.        mov    ah,10h                ;EGA/VGA Set Palette Register BIOS call
  840.        mov    al,10h
  841.        mov    bx,PALETTE_REG_LOW    ;Palette register to be re-programmed
  842.                                     ; for low order pels.
  843.        mov    ch,GREEN_INTENSITY    ;Load new values
  844.        mov    cl,BLUE_INTENSITY
  845.        mov    dh,RED_INTENSITY
  846.        int    10h
  847.  
  848.        mov    ah,10h                ;EGA/VGA Set Palette Register BIOS call
  849.        mov    al,10h
  850.        mov    bx,PALETTE_REG_HIGH   ;Palette register to be re-programmed
  851.                                     ; for high order pels.
  852.        mov    ch,GREEN_INTENSITY
  853.        mov    cl,BLUE_INTENSITY
  854.        mov    dh,RED_INTENSITY
  855.        int    10h
  856.  
  857.      where:
  858.        PALETTE_REG_LOW  = low  pel palette register (00,01,02,..,0F)
  859.        PALETTE_REG_HIGH = high pel palette register (00,10,20,..,F0)
  860.  
  861.        GREEN_INTENSITY
  862.        BLUE_INTENSITY  = 6 bit intensity values for defining the default color
  863.        RED_INTENSITY
  864.  
  865.  
  866. 4.39 1024x768 - 4 COLORS (Mode 67h)
  867.  
  868.      Video Memory Organization:
  869.  
  870.      The memory organization is identical to the IBM 16 color EGA and VGA
  871.      modes. 256K of RAM is divided into 4 maps of 64k. The IBM EGA/VGA Map
  872.      Mask Register is used to select the maps to be updated.
  873.  
  874.      A0000:0->/------\
  875.               |      | /------\
  876.               |  C0  | |      | /------\
  877.               \------/ |  C1  | |      | /------\ <---+
  878.               Plane 0  \------/ |  C0  | |      |     49152 bytes/plane
  879.               ^        Plane 1  \------/ |  C1  |     |
  880.               |              ^  Plane 2  \------/ <---+
  881.               |              |  ^         Plane 3
  882.               \---odd pels---/  |               ^
  883.                                 |               |
  884.                                 \---even pels---/
  885.  
  886.  
  887.      Video Data Format:
  888.  
  889.      This mode uses a unique data format where 2 bits are required per pel.
  890.      Plane 0 and 1 contain the data for odd numbered pels and Planes 2 and
  891.      3 contain the data for the even numbered pels.
  892.  
  893.      Color Mapping:
  894.  
  895.      This mode supports four palette selections. The palette or color set
  896.      is selected by setting bits 0 & 1 of the IBM EGA/VGA Color Select
  897.      Register.
  898.  
  899.                                    Color Values (C0, C1)
  900.      Color set #        C0=0,C1=0  C0=1,C1=0  C0=0,C1=1  C0=1,C1=1
  901.  
  902.          0              black        white      grey     bright white
  903.          1              black        cyan       red      white
  904.          2              black        green      red      yellow
  905.          3              black        cyan       magenta  white
  906.  
  907.      Examples:
  908.  
  909.      The following examples use standard IBM EGA/VGA registers. If more
  910.      information is required, consult the EGA/VGA programmers reference
  911.      list included in this document.
  912.  
  913.  
  914.      Segment example for selecting the active palette or color set:
  915.  
  916.        mov   dx,03dah      ;Load Input Status Register One
  917.                            ;
  918.      wait:
  919.        in    al,dx         ;Wait for vertical retrace bit to be set
  920.        test  al,8          ; (bit 3 = 1)
  921.        jnz   wait          ;It is good practise to wait for the vertical
  922.                            ; retrace bit before directly modifying the
  923.                            ; palette registers
  924.  
  925.        mov   ah,ARG        ;Arg = color set # (0 to 3)
  926.        mov   cl,4          ;Multiply arg by 8 so that bits 4 & 5 of the
  927.        shl   ah,cl         ; palette registers can be modified
  928.        mov   dx,03c0h      ;Load Palette Control Register
  929.        mov   cx,16         ;16 Palette registers to be modified
  930.        xor   bl,bl         ;Start from 0
  931.                            ;
  932.      repeat:               ;Modify bits 4 & 5 of all 16 palette registers with
  933.        mov   al,bl         ; Arg value (color set #)
  934.        out   dx,al         ;Select palette register
  935.        or    al,ah
  936.        out   dx,al         ;Write modified data to selected palette register
  937.        loop  repeat
  938.  
  939.        mov   al,20h        ;Restore internal registers access to palette data 
  940.        out   dx,al         ; bit 5 must be zero during palette data writing 
  941.                            ; and one after data writing is complete
  942.  
  943.  
  944.      Segment example for selecting Bit Planes to be modified during a
  945.      memory write:
  946.  
  947.        mov   dx,03c4h      ;Load Sequencer Address Register
  948.        mov   al,2          ;Load index of Map Mask Register
  949.        out   dx,al         ;Select Map Mask Register
  950.        inc   dl
  951.        mov   al,ARG        ;Value to select which bit planes are to be
  952.                            ; modified during a memory write
  953.        out   dx,al         ;Select EGA/VGA planes to be modified
  954.  
  955.  
  956.      IBM EGA/VGA Map Mask Register (3C5h, index 2) organization:
  957.  
  958.        Bits:   0     Controls access to Bit Plane 0
  959.                1     Controls access to Bit Plane 1
  960.                2     Controls access to Bit Plane 2
  961.                3     Controls access to Bit Plane 3
  962.                4-7   Not used
  963.  
  964.        A bit value of 0 disables access to the corresponding Bit Plane and a
  965.        bit value of 1 enables it.
  966.  
  967. 4.4  SPECIAL NOTES
  968.  
  969. 4.41 NOTE ON EXTENDED REGISTER ADDRESS
  970.  
  971.      Hard-coding this value is not recommended since it is programmable
  972.      and may be changed in subsequent BIOS releases. The value of
  973.      EXTENDED_REG should be retrieved from the BIOS at location C000:0010h.
  974.      The 'mov dx, EXTENDED_REG statement in the page selecting segment can
  975.      be replaced with code to load the value of EXTENDED_REG from its stored
  976.      location. The registers that need to be saved will depend greatly on
  977.      the particular application:
  978.  
  979.               push es         ;save registers es and bx
  980.               push bx
  981.               mov  ax,0c000h  ;define storage location of EXTENDED_REG
  982.               mov  es,ax
  983.               mov  bx,10h
  984.               mov  dx,es:[bx] ;get the value of EXTENDED_REG from contents
  985.                               ;of the storage location C000:0010h
  986.               pop  bx         ;restore registers es and bx
  987.               pop  es
  988.  
  989. 4.42 NOTE ON DAC REGISTER PROGRAMMING
  990.      In IBM VGA mode 13h (320x200 - 256 color), each color is controlled by
  991.      a corresponding DAC register. There are a total of 256 18-bit DAC
  992.      registers. Therefore, each DAC register can be assigned a color value
  993.      from 0 (BLACK) to 262,143 (BRIGHT WHITE). The first 16 DAC registers
  994.      have assigned color values that correspond to the 16 colors used in
  995.      mode 12h (640x480 - 16 color).  DAC register zero, which has an
  996.      assigned color value of 0 (BLACK), also controls the color of the
  997.      overscan border. This function is also supported in ATI modes 61, 62,
  998.      63, and 65h. On some analog monitors, a non-BLACK overscan border may
  999.      cause line wrapping at either the top or bottom of the screen image
  1000.      due to the video bandwidth required. For this reason, it is not
  1001.      recommended to change the color value of this DAC register.
  1002.  
  1003. 4.43 BIOS FUNCTION SUPPORT
  1004.  
  1005.      Many versions of the VGAWONDER do not support certain video BIOS
  1006.      function calls in some extended video modes due to EPROM space 
  1007.      limitations. Programmers should assume that the following functions
  1008.      are not supported in the indicted modes:
  1009.  
  1010.               MODE #              BIOS FUNCTION
  1011.  
  1012.               61h, 62h, 63h,      ah = 06h - Scroll active page up
  1013.               65h, 67h            ah = 07h - Scroll active page down
  1014.                                   ah = 09h - Read Character at Cursor
  1015.                                   ah = 0ch - Write Dot
  1016.                                   ah = 0dh - Read Dot
  1017.                                   ah = 0eh - Write TTX
  1018.  
  1019.      All extended modes have only one active page regardless of the amount
  1020.      of memory installed.
  1021.  
  1022. 5.0  APPENDIX
  1023.  
  1024. 5.1  LIST OF SUGGESTED REFERENCES
  1025.  
  1026.      TITLE:       Programmer's Guide to the EGA/VGA *
  1027.      AUTHOR:      George Sutty and Steve Blair
  1028.      PUBLISHER:   Brady Books / Simon and Schuster, Inc.
  1029.      DATE:        1988
  1030.  
  1031.      TITLE:       Advanced Programmer's Guide to SuperVGAs *
  1032.      AUTHOR:      George Sutty and Steve Blair
  1033.      PUBLISHER:   Brady Books / Simon and Schuter, Inc.
  1034.      DATE:        1990                                 
  1035.  
  1036.      TITLE:       Programmer's Guide to IBM PC and PS/2 Video Systems
  1037.      AUTHOR:      Richard Wilton
  1038.      PUBLISHER:   MicroSoft Press
  1039.      DATE:        1987
  1040.  
  1041.      TITLE:       Programmer's Guide to the EGA and VGA Cards
  1042.      AUTHOR:      Richard F. Ferraro
  1043.      PUBLISHER:   Addison - Wesley Publishing Co.
  1044.      DATE:        July, 1988
  1045.  
  1046.      TITLE:       EGA/VGA A Programmer's Reference Guide
  1047.      AUTHOR:      Bradley Dyck Kliewer
  1048.      PUBLISHER:   McGraw Hill
  1049.      DATE:        1988
  1050.  
  1051.      TITLE:       Personal System/2 Model 50 and 60 Technical Reference
  1052.      AUTHOR:      unknown
  1053.      PUBLISHER:   IBM
  1054.      DATE:        April, 1987
  1055.  
  1056.      TITLE:       Personal System/2 and Personal Computer BIOS Interface
  1057.                   Technical Reference
  1058.      AUTHOR:      unknown
  1059.      PUBLISHER:   IBM
  1060.      DATE:        April, 1987
  1061.  
  1062.      TITLE:       Programmer's Reference Manual for the VGAWONDER  *
  1063.      AUTHOR:      various                
  1064.      PUBLISHER:   ATI Technologies (order from Tech Support $40)
  1065.      DATE:        1990
  1066.               * recommended
  1067.  
  1068.  
  1069.      TO OBTAIN A PRINT COPY OF THIS DOCUMENT ON YOUR SYSTEM
  1070.      PRINTER, ENTER THE FOLLOWING COMMAND AT THE DOS PROMPT:
  1071.  
  1072.               TYPE PROGINFO.DOC>PRN <rtn>
  1073.  
  1074.